#include <pthread.h>
#include <stdio.h>
#include <unistd.h>

#define NUM 5

void *print_hello(void *p)
{
	char *cp = (char*)p;
	int i;
	for(i=0;i<NUM;i++)
	{
		printf("%s\n", cp);
		fflush(stdout);
		sleep(1);
	}
	return NULL;
}
	

int main(int argc, char **argv)
{
	pthread_t thread1, thread2;
	
	pthread_create(&thread1, NULL, print_hello, (void*)"hello");
	pthread_create(&thread2, NULL, print_hello, (void*)"world");

	pthread_join(thread1, NULL);
	pthread_join(thread2, NULL);

	return 0;
}
